'''
    使用while和for…in两个循环分别输出四种九九乘法表效果
'''

# 使用 for in实现四种九九乘法表
# 第一种
print("="*20,"for in 第一种","="*20)
for row in range(1,10):
    for col in range(1,row+1):
        print('{}*{}={:<4}'.format(row,col,row*col),end=' ')
    print('')

print('')
print('='*60)

#第二种
print("="*20,"for in 第二种","="*20)
for row in range(9,0,-1):
    for col in range(1,row+1):
        print('{}*{}={:<4}'.format(row,col,row*col),end=' ')
    print('')

print('')
print('='*60)
# 第三种
print("="*20,"for in 第三种","="*20)
for row in range(9,0,-1):
    s=''
    for col in range(row,0,-1):
        s += '{}*{}={:<4}'.format(col, row, row * col)
    print('{:>72}'.format(s))
print('')
print('='*60)

# 第四种
print("="*20,"for in 第四种","="*20)
for row in range(1,10):
    s=''
    for col in range(row,0,-1):
        s += '{}*{}={:<4}'.format(col, row, row * col)
    print('{:>72}'.format(s))
print('')
print('='*60)

# While循环
# 第一种
print("="*20,"while循环 第一种","="*20)
row = 1
while row<= 9 :
   col=1
   while col <=row :
      print("{}*{}={:<4}".format(row,col,row*col),end=" ")
      col += 1

   row += 1
   print()

print('')
print('='*60)
#第二种
print("="*20,"while循环 第二种","="*20)
row = 9
while row>=1 :
   col=1
   while col <=row :
      print("{}*{}={:<4}".format(row,col,row*col),end=" ")
      col += 1

   row -= 1
   print('')
#第三种
print("="*20,"while循环 第三种","="*20)
row = 1
while row<= 9 :
   col=1
   s = ''
   while col <=row :
      s += '{}*{}={:<4}'.format(col, row, col * row)
      col += 1

   row += 1
   print('{:>72}'.format(s))

print('')
print('='*60)
#第四种
print("="*20,"while循环 第四种","="*20)
row = 9
while row>= 1 :
   col=1
   s = ''
   while col <=row :
      s += '{}*{}={:<4}'.format(col, row, col * row)
      col += 1

   row -= 1
   print('{:>72}'.format(s))

print('')
print('='*60)